import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'user_add_goods_comment_response.freezed.dart';
part 'user_add_goods_comment_response.g.dart';

@freezed
class UserAddGoodsCommentResponse with _$UserAddGoodsCommentResponse {
  const factory UserAddGoodsCommentResponse({
    @JsonKey(name: "code") required int code,
    @JsonKey(name: "msg") required String msg,
    @JsonKey(name: "time") required int time,
    @JsonKey(name: "data") required List<Datum> data,
  }) = _UserAddGoodsCommentResponse;

  factory UserAddGoodsCommentResponse.fromJson(Map<String, dynamic> json) =>
      _$UserAddGoodsCommentResponseFromJson(json);
}

@freezed
class Datum with _$Datum {
  const factory Datum({
    @JsonKey(name: "id") required int id,
    @JsonKey(name: "content") required String content,
    @JsonKey(name: "to_name") required String toName,
    @JsonKey(name: "like_num") required int likeNum,
    @JsonKey(name: "user_id") required int userId,
    @JsonKey(name: "fa_user_id") required int faUserId,
    @JsonKey(name: "nickname") required String nickname,
    @JsonKey(name: "avatar") required String avatar,
    @JsonKey(name: "create_time") required DateTime createTime,
    @JsonKey(name: "ziji_id") required int zijiId,
  }) = _Datum;

  factory Datum.fromJson(Map<String, dynamic> json) => _$DatumFromJson(json);
}
